//
//  ViewController.m
//  自定义转场动画
//
//  Created by MyMac on 15/8/18.
//  Copyright (c) 2015年 MyMac. All rights reserved.
//

#import "ViewController.h"
#import "BaseViewController.h"
#import "CustomTransitionAnimation.h"
@interface ViewController ()<UINavigationControllerDelegate>
@property(nonatomic,strong)CustomTransitionAnimation*transitionAnimation;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.imageView=[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    _imageView.image=[UIImage imageNamed:@"屏幕快照 2015-09-16 下午3.04.35"];
    [self.view addSubview:_imageView];
    
    
    self.view.backgroundColor=[UIColor redColor];
    self.transitionAnimation=[[CustomTransitionAnimation alloc]init];
    self.transitionAnimation.duration=4.0;
    self.transitionAnimation.operation=UINavigationControllerOperationPush;
        self.navigationController.delegate=self;

}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    BaseViewController*vc=[[BaseViewController alloc]init];

    [self.navigationController pushViewController:vc animated:YES];



}
- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation
                                                 fromViewController:(UIViewController *)fromVC
                                                   toViewController:(UIViewController *)toVC
{
    self.transitionAnimation.operation=operation;
    return self.transitionAnimation;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
